package com.yin.myproject.thread.listblock;

import java.util.concurrent.locks.Lock;

/**
 * @author Eason
 * @create 2018-03-09 16:17
 **/
public class CompositeLockMain {
    //private static Lock lock = new TimeCost(new ArrayLock(150));

    private static Lock lock = new CompositeLock();


    private static volatile int value = 0;

    public static void method() {
        lock.lock();
        System.out.println("Value: " + ++value);
        lock.unlock();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 1; i++) {
            Thread t = new Thread(() -> method());
            t.start();
        }
    }
}
